//
//  UIView+SK.m
//  loveKangaroo
//
//  Created by SeeKool on 15/3/3.
//  Copyright (c) 2015年 SeeKool Inc. All rights reserved.
//

#import "UIView+SK.h"

@implementation UIView (SK)
- (void)setSize:(CGSize)size{
    
    CGRect tempFrame = self.frame;
    tempFrame.size = size;
    self.frame = tempFrame;
}
- (CGSize)size{
    return self.frame.size;
}

- (CGFloat)x{
    return self.frame.origin.x;
}
- (void)setX:(CGFloat)x{
    CGRect tempFrame = self.frame;
    tempFrame.origin.x = x;
    self.frame = tempFrame;
}
- (CGFloat)y{
    return self.frame.origin.y;
}
- (void)setY:(CGFloat)y{
    CGRect tempFrame = self.frame;
    tempFrame.origin.y = y;
    self.frame = tempFrame;
}
- (CGFloat)centerX{
    return self.center.x;
}
- (void)setCenterX:(CGFloat)centerX{
    CGPoint tempCenter = self.center;
    tempCenter.x = centerX;
    self.center = tempCenter;
}
- (CGFloat)centerY{
    return self.center.y;
}
- (void)setCenterY:(CGFloat)centerY{
    CGPoint tempCenter = self.center;
    tempCenter.y = centerY;
    self.center = tempCenter;
    
}
- (CGFloat)width{
    return self.frame.size.width;
}
- (void)setWidth:(CGFloat)width{
    CGRect tempFrame = self.frame;
    tempFrame.size.width = width;
    self.frame = tempFrame;
}
- (CGFloat)height{
    return self.frame.size.height;
}
- (void)setHeight:(CGFloat)height{
    
    CGRect tempFrame = self.frame;
    tempFrame.size.height = height;
    self.frame = tempFrame;
}

- (CGFloat)left{
    return self.x;
}

- (CGFloat)right{
    return self.width + self.x;
}
- (CGFloat)bottom{
    return self.y + self.height;
}
- (CGFloat)top{
    return self.y;
}
- (void)setRight:(CGFloat)right{
    CGRect tempFrame = self.frame;
    tempFrame.size.width = right - tempFrame.origin.x;
    self.frame = tempFrame;
}
- (void)setLeft:(CGFloat)left{
    CGRect tempFrame = self.frame;
    tempFrame.origin.x = left;
    self.frame = tempFrame;
}
- (void)setBottom:(CGFloat)bottom{
    CGRect tempFrame = self.frame;
    tempFrame.size.height = bottom - tempFrame.origin.y;
    self.frame = tempFrame;
}
- (void)setTop:(CGFloat)top{
    CGRect tempFrame = self.frame;
    tempFrame.origin.y = top;
    self.frame = tempFrame;
}
@end
